<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
session_start();

error_reporting(-1);

class Sms extends CI_Controller {

	function __construct() {
		parent::__construct();

	}
	function index()
	{
		parse_str($_SERVER['QUERY_STRING'],$_GET);
		//print_r($_GET);  die();
		//echo $_GET['smsid'];die();
		$smsid = isset($_GET['smsid']) ? $_GET['smsid']  : '';
		$mobilenumber = isset($_GET['sender']) ? $_GET['sender']  : '';
		$shortcode = isset($_GET['shortcode']) ? $_GET['shortcode']  : '';
		$content =   isset($_GET['content']) ? urldecode($_GET['content'])  : '';
		$content = trim($content);
		$this->load->model('api_model');
		$this->load->model('sms_model');
		$contents = explode(" ", $content);
		$result = $this->sms_model->add_sms($smsid,$mobilenumber,$shortcode,$content);
		$datas = $this->api_model->get_api($contents[1],$contents[2]);   
		echo $datas;
		/*if($datas <> null){
			return $datas;
		}else{  
			return "Sai cu phap hoac dich vu nay da bi tam dung. Ban se duoc hoan tien tin nhan nay trong vong tu 7 - 20 ngay. Xin cam on";
		} */

	}
}

?>